const { hasEnvironment } = require('./utils');

if ( !hasEnvironment()) {
  throw Error('jjb.script[build]: 启动build需要提供NODE_ENV变量，请确认你所运行的脚本是否正确？');
}

require('webpack')(require('./config')('production').webpack).run(function (stat, compiler) {
  if ( !compiler.compilation.errors.length) {
    console.log('组件Build完成!');
  } else {
    console.log('组件Build失败，发现以下问题，请解决后重试!');
    console.log(compiler.compilation.errors);
  }
});
